package com.qust.endecryptionmanager.controller;

import com.qust.agreement.result.Result;
import com.qust.endecryptionmanager.service.LoadBalanceService;
import com.qust.endecryptionmanager.service.imp.LoadBalanceServiceImp;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/LoadBalance")
public class LoadBalanceController {
    private final LoadBalanceService loadBalanceService;

    public LoadBalanceController(LoadBalanceService loadBalanceService) {
        this.loadBalanceService = loadBalanceService;
    }

    @GetMapping("/{number}")
    public Result<?> getConnectChannel(@PathVariable int number){
        return Result.success(loadBalanceService.getConnectAddress(number));
    }

}
